from django.db import models


class City(models.Model):
    CITY_CATEGORY_STATE = 'S'
    CITY_CATEGORY_CITY = 'C'
    CITY_CATEGORY_AREA = 'A'
    CITY_CATEGORY_CHOICES = ((CITY_CATEGORY_STATE, '州'),
                         (CITY_CATEGORY_CITY, "市"),(CITY_CATEGORY_AREA, "区"))
    city_name = models.CharField('城市名称', max_length=50,null=True,blank=True)
    city_code = models.CharField('城市代码', max_length=50,null=True,blank=True)
    state_name = models.CharField('州名称', max_length=50,null=True,blank=True)
    state_code = models.CharField('州代码', max_length=50,null=True,blank=True)
    area_name = models.CharField('地区名称', max_length=50,null=True,blank=True)
    category = models.CharField('级别',max_length=1,choices=CITY_CATEGORY_CHOICES,default=CITY_CATEGORY_STATE)
    parent = models.ForeignKey('self',null=True,blank=True)


class Feature(models.Model):
    name = models.CharField('特色名称', max_length=50)


class Fitting(models.Model):
    """
    床、浴室、网、冰箱、电视、洗衣机、电脑、暖气、空调、天然气、电梯、车位、地下室
    """
    name = models.CharField('配件设施', max_length=50)


class BaseData:
    position_array = ['东', '南', '西', '北', '南北通透']
    decorate_array = ['精装修', '简装修', '无装修', '中等装修', '豪华装修']
    rent_way_array = ['整租', '合租', '日租']
    house_type_array = ['普通住宅', '经济适用房', '公寓', '商住楼', '酒店式公寓']
    rent_money_array =['500', '500-1000', '1000-1500', '1500-2000', '2000-3000', '3000-5000', '5000']
    house_layout_array = ['1室1厅','2室1厅','2室2厅','3室1厅','3室2厅','4室2厅','4室3厅','其他']

    def array_to_tuple(arr_obj):
        return tuple([(x, x) for x in arr_obj])
